package com.zhdl.hardware_contact.hardware_common.repository;

import com.zhdl.common.ytools.callback.CommonCallback;
import com.zhdl.hardware_contact.hardware_common.param.CurrencyProtocolReadReq;
import com.zhdl.hardware_contact.hardware_common.param.CurrencyProtocolWriteReq;
import com.zhdl.network.strategy.common_client.dto.SendReceiverData;

public interface CurrencyProtocolCmdHandleService {
    /**
     * 添加网口 IP+端口
     * 配置协议 为Null 则默认一条协议 RTU/TCP
     * 配置后置 为Null 则默认一条后置 RTU/TCP
     *
     * @param sendReceiverData IP Protocol After
     */
    void addIpPort(SendReceiverData sendReceiverData);

    /**
     * 通用协议-读取功能码01 读线圈
     *
     * @param protocolReadReq 读取参数
     * @param callback        回调
     */
    void readFunctionCode01(String port, CurrencyProtocolReadReq protocolReadReq, CommonCallback<String> callback);

    /**
     * 通用协议-读取功能码03 读保持寄存器
     *
     * @param protocolReadReq 读取参数
     * @param callback        回调
     */
    void readFunctionCode03(String port, CurrencyProtocolReadReq protocolReadReq, CommonCallback<String> callback);

    /**
     * 通用协议-写入功能码05 写入单个线圈
     *
     * @param protocolWriteReq 写入参数
     */
    void writeFunctionCode05(String port, CurrencyProtocolWriteReq protocolWriteReq);

    /**
     * 通用协议-写入功能码15 写入多个线圈
     *
     * @param protocolWriteReq 写入参数
     */
    void writeFunctionCode15(String port, CurrencyProtocolWriteReq protocolWriteReq);

    /**
     * 通用协议-写入功能码06 写入单个寄存器
     *
     * @param protocolWriteReq 写入参数
     */
    void writeFunctionCode06(String port, CurrencyProtocolWriteReq protocolWriteReq);

    /**
     * 通用协议-写入功能码10 写入多个寄存器
     * 注: RTU则功能码为16
     *
     * @param protocolWriteReq 写入参数
     */
    void writeFunctionCode10(String port, CurrencyProtocolWriteReq protocolWriteReq);

    /**
     * 自定义协议-测试
     */
    void customFunctionCodeDemo();
}
